<?php

/**
 * Coligacao form base class.
 *
 * @method Coligacao getObject() Returns the current form's model object
 *
 * @package    siscampanha
 * @subpackage form
 * @author     Alexandre Haguiar
 */
abstract class BaseColigacaoForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'partido'     => new sfWidgetFormInputText(),
      'campanha_id' => new sfWidgetFormPropelChoice(array('model' => 'Campanha', 'add_empty' => false)),
      'data_inicio' => new sfWidgetFormDate(),
      'data_fim'    => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'partido'     => new sfValidatorString(array('max_length' => 45)),
      'campanha_id' => new sfValidatorPropelChoice(array('model' => 'Campanha', 'column' => 'id')),
      'data_inicio' => new sfValidatorDate(),
      'data_fim'    => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('coligacao[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Coligacao';
  }


}
